<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8">
    <title>短信记录</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <!-- load css -->
    <link rel="stylesheet" th:href="@{/css/font.css}" />
	<link rel="stylesheet" th:href="@{/css/xadmin.css}" />
    <script type="text/javascript" th:src="@{/js/jquery.min.js}"></script>
    <script th:src="@{/js/layui/layui.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/js/xadmin.js}"></script>
</head>
<body class="layui-anim layui-anim-fadein">
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a>账号管理</a>
        <a><cite>短信记录</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
      <div class="layui-row">
        <div class="layui-form layui-col-md12 x-so">
           <input id="phone" type="text" name="phone"   placeholder="手机号" autocomplete="off" class="layui-input">
          <div class="layui-input-inline">
            <select id="type" name="type">
              <option value="">全部</option>
              <option value="1">注册</option>
              <option value="2">登录</option>
              <option value="3">取卡</option>
            </select>
          </div>
          <button id="searchBtn" data-type="reload" class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
        </div>
      </div>
      <table class="layui-hide" id="table1" lay-filter="tool1"></table>
      </div>
<script type="text/html" id="typeTpl">
{{#  if(d.type == 1){  }}
<span style="color: blue;">注册</span>
{{#  }else if(d.type == 2){  }}
<span style="color: blue;">登录</span>
{{#  }else if(d.type == 3){  }}
<span style="color: blue;">取卡</span>
{{#  }  }}
</script>
<script>
      layui.use(['laydate', 'laypage', 'table', "upload"], function(){
        var laydate = layui.laydate,
        table = layui.table, //表格
        laypage = layui.laypage, //分页
        upload = layui.upload;//主要是这个
        //执行一个 table 实例
        table.render({
          elem: '#table1'
          ,height: 650
          ,limit: 14
          ,limits:[14,20,30,40,50,60,70,80,90]
          ,url: '[[@{/admin/msg/list.html}]]' //数据接口
          ,id:'table1'
          ,page: true
          ,cols: [
           [
            {field: 'id', title: 'ID', width:'10%', sort: true, align:'center',fixed: 'left'}
            ,{field: 'phone', title: '手机号', width: '10%', align:'center'}
            ,{field: 'type', title: '短信类型', width: '10%', align:'center',templet:'#typeTpl'}
            ,{field: 'create_time', title: '接收时间', width: '10%', align:'center'}
            ,{field: 'content', title: '短信内容', width: '59%', align:'center'}
          ]
          ]
        });
        $('#searchBtn').on('click', function(){
        	var index = layer.msg('查询中，请稍候...',{icon: 16,time:false,shade:0});
        	table.reload('table1', {
    	        page: {
    	          curr: 1 //重新从第 1 页开始
    	        }
    	        ,where: {
    	        	'phone': $('#phone').val(),
    	        	'type': $('#type').val()
    	        }
    	      });
        	layer.close(index);
       });
        
      });
    </script>
  </body>
</html>
